Skip to content

Commit c13eeba

Browse files
committed
Merge branch 'topic-insert-linefeed'
2 parents 2a7790e + 0b1079b commit c13eeba

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pcbasic/basic/display/text.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ def scroll_down(self, pagenum, from_line, bottom, attr):
138138
self.pages[pagenum].row.insert(
139139
from_line - 1, TextRow(attr, self.width, self._conv, self._dbcs_enabled)
140140
)
141+
# if we were already a wrapping row, make sure the new empty row wraps
142+
if self.pages[pagenum].row[from_line-2].wrap:
143+
self.pages[pagenum].row[from_line-1].wrap = True
141144
del self.pages[pagenum].row[bottom-1]
142145

143146
def get_char(self, pagenum, row, col):

pcbasic/basic/display/textscreen.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,9 @@ def _insert_fullchar_at(self, row, col, c, attr):
595595
else:
596596
therow.end = col
597597
self._redraw_row(col-1, row)
598+
if therow.wrap and therow.end == self.mode.width:
599+
self.scroll_down(row+1)
600+
therow.wrap = True
598601
return True
599602
else:
600603
# pushing the end of the row past the screen edge
@@ -627,6 +630,7 @@ def line_feed(self):
627630
# adjust end of line and wrapping flag - LF connects lines like word wrap
628631
self.text.pages[self.apagenum].row[self.current_row-1].end = self.current_col - 1
629632
self.text.pages[self.apagenum].row[self.current_row-1].wrap = True
633+
# cursor stays in place after line feed!
630634
else:
631635
# find last row in logical line
632636
end = self.text.find_end_of_line(self.apagenum, self.current_row)
@@ -641,8 +645,13 @@ def line_feed(self):
641645
# self.current_row has changed, don't use row var
642646
if self.current_row < self.mode.height:
643647
self.scroll_down(self.current_row+1)
644-
self.text.pages[self.apagenum].row[self.current_row].wrap = True
645-
# cursor stays in place after line feed!
648+
# if we were already a wrapping row, make sure the new empty row wraps
649+
#if self.text.pages[self.apagenum].row[self.current_row-1].wrap:
650+
# self.text.pages[self.apagenum].row[self.current_row].wrap = True
651+
# ensure the current row now wraps
652+
self.text.pages[self.apagenum].row[self.current_row-1].wrap = True
653+
# cursor moves to start of next line
654+
self.set_pos(self.current_row+1, 1)
646655

647656
###########################################################################
648657
# vpage text retrieval

0 commit comments

Comments
 (0)