__ini_value: draft of comment handling

work in progress for a long time and I didn't touched it again till just
to commit it ... I have to work on it.
This commit is contained in:
matze 2021-09-29 20:23:01 +02:00
parent 9d9577d891
commit 122354a0dc
1 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,57 @@
# We try to find a comment block -- how?
# check how much paragraphs it has
# check if
#
# this code is crap - at least not well written
# Check the buffer if the comment was found
function check_comments() {
_lastline = bufindex - (buflen - 1)
_comm_size = length(comments)
lastfreeline = 0
lastfreecommline = 0
comm_index = 0
# go through all lines
for(i = bufindex; i < _lastline; i++) {
_line = trim(linebuf[i])
# empty line?
if(_line == "") {
lastfreeline = i
continue
}
# line start matched
if(_line == trim(comments[comm_index])) {
# end? else continue
if(comm_index < _comm_size) {
continue
}
else {
}
}
# reset again cause not matched
else comm_index = 0
# empty comment line
if(is_comment(_line)) {
_comment = trim(substr(_line, 2))
# check if empty comment
if(_comment == "") {
lastfreecommline = i
}
}
# check if comments fit in or is too big
if((_lastline - bufindex) < _comm_size) {
# too short
}
else {
#if()
}
}
}