reflow branch: cursor positions get set to -1,-1

Bug #1861444 reported by Björn Linse
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvterm
New
Undecided
Unassigned

Bug Description

Libvterm gives the following assertion error

ASSERT fail: resize moved cursor outside the field to (-1,-1)

which causes subsequent errors, i e attempting to fetch the cell gives an invalid cell with width zero, which causes an infinite loop in pangoterm.

This happens after after cat:ing some text and then returning to zsh shell prompt, and then making the terminal very narrow (narrower than the shell prompt, roughly)

Revision history for this message
Paul "LeoNerd" Evans (leonerd) wrote :

> then making the terminal very narrow (narrower than the shell prompt, roughly)

I think this may be the killer part. It's about making the window narrower than the current cursor position. It doesn't normally break for me but my $PS1 ends "...\n$ " whereas if I set one that doesn't have a near-end linefeed, then I can get mine to break a lot earlier, in the same way.

Revision history for this message
Jörg (joergrichter) wrote :

I've got the same problem (state->pos.row is negative). This happens because state.cc:onresize calls screen.cc:resize (with callback) and passes on the VTermStateFields with the current cursor position.
This position is modified in resize_buffer to a negative value (statefields->pos.row -= (old_row + 1))
After the callback the fields are copied back to state->pos.

I fixed it with the following patch:

--- a/gui/vterm/state.c
+++ b/gui/vterm/state.c
@@ -1720,8 +1720,12 @@ static int on_resize(int rows, int cols, void *user)

   if(state->pos.row >= rows)
     state->pos.row = rows - 1;
+ else if(state->pos.row < 0)
+ state->pos.row = 0;
   if(state->pos.col >= cols)
     state->pos.col = cols - 1;
+ else if(state->pos.col < 0)
+ state->pos.col = 0;

   updatecursor(state, &oldpos, 1);

Revision history for this message
Jörg (joergrichter) wrote :

By bug was not with the reflow-branch. And it is already fixed in the trunk. Sorry for the noise

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.