Permalink
Browse files

Implement xterm mouse mode

  • Loading branch information...
1 parent 6f0669b commit 5ef7f43479327b2ad3e96439c4785af2c658dfab @niieani niieani committed with keithw Sep 8, 2013
View
6 src/terminal/terminaldisplay.cc
@@ -292,6 +292,12 @@ std::string Display::new_frame( bool initialized, const Framebuffer &last, const
frame.append( f.ds.bracketed_paste ? "\033[?2004h" : "\033[?2004l" );
}
+ /* has xterm mouse mode changed (SET_ANY_EVENT_MOUSE)? */
+ if ( (!initialized)
+ || (f.ds.xterm_mouse != frame.last_frame.ds.xterm_mouse) ) {
+ frame.append( f.ds.xterm_mouse ? "\033[?1002h" : "\033[?1002l" );
+ }
+
return frame.str;
}
View
3 src/terminal/terminalframebuffer.cc
@@ -62,7 +62,8 @@ DrawState::DrawState( int s_width, int s_height )
renditions( 0 ), save(),
next_print_will_wrap( false ), origin_mode( false ), auto_wrap_mode( true ),
insert_mode( false ), cursor_visible( true ), reverse_video( false ),
- bracketed_paste( false ), application_mode_cursor_keys( false )
+ bracketed_paste( false ), xterm_mouse( false ),
+ application_mode_cursor_keys( false )
{
reinitialize_tabs( 0 );
}
View
3 src/terminal/terminalframebuffer.h
@@ -190,6 +190,7 @@ namespace Terminal {
bool cursor_visible;
bool reverse_video;
bool bracketed_paste;
+ bool xterm_mouse;
bool application_mode_cursor_keys;
@@ -239,7 +240,7 @@ namespace Terminal {
return ( width == x.width ) && ( height == x.height ) && ( cursor_col == x.cursor_col )
&& ( cursor_row == x.cursor_row ) && ( cursor_visible == x.cursor_visible ) &&
( reverse_video == x.reverse_video ) && ( renditions == x.renditions ) &&
- ( bracketed_paste == x.bracketed_paste );
+ ( bracketed_paste == x.bracketed_paste ) && ( xterm_mouse == x.xterm_mouse );
}
};
View
3 src/terminal/terminalfunctions.cc
@@ -268,6 +268,9 @@ static bool *get_DEC_mode( int param, Framebuffer *fb ) {
return &(fb->ds.auto_wrap_mode);
case 25:
return &(fb->ds.cursor_visible);
+ case 1000: /* xterm mouse 1 (normal) */
+ case 1002: /* xterm mouse 2 (inc. button drags) */
+ return &(fb->ds.xterm_mouse);
case 2004: /* bracketed paste */
return &(fb->ds.bracketed_paste);
}

0 comments on commit 5ef7f43

Please sign in to comment.