Re: Linux: position() bug?
- Posted by jimcbrown (admin) Jan 23, 2012
- 1394 views
K_D_R said...
Running the demo file search.ex:
This is a screen capture from a run of the demo file search.ex:
string (* and ? may be used): load_files y --<<<-- cursor placed here after displaying "match case? (n)" match case? (n) file-spec (*.*): *.ex n --<<<-------- ? press q to quitries? (y) --? 23 files scanned (*.ex) 20 files skipped 0 files contained "load_files" (case must match) search time: 0.0 seconds
This is the code segment form search.ex:
if alphabetic(orig_string) then puts(SCREEN, "match case? (n)") pos = get_position() position(pos[1], pos[2] - 2)--<<<----- pos[1] should place on the same line as the match case? (n)" prompt, yes? match_case = find('y', gets(KEYB)) puts(SCREEN, '\n') -- -- puts(SCREEN, "scan subdirectories? (y)") pos = get_position() position(pos[1], pos[2] - 2) --<<------- scan_subdirs = not match("n", gets(KEYB))
Regards, Kenneth Rhodes
Confirmed. It looks like what's happening is that we aren't updating our internal line count, screen_line, in be_w.c when gets(0) is called. As a result, we miss the newline at the end and our line count is off by one for each gets(0) call.