From e115f05f0de566bf3dbd5b847e10467e0e9f8402 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Tue, 9 Sep 2014 20:51:07 -0400 Subject: [PATCH] Clear other mouse modes if 1000 or 1002 are set I'm not sure if this is correct, but tmux does this! Signed-off-by: Andrew Chin --- src/terminal/terminalfunctions.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/terminal/terminalfunctions.cc b/src/terminal/terminalfunctions.cc index 63558f0..c167c63 100644 --- a/src/terminal/terminalfunctions.cc +++ b/src/terminal/terminalfunctions.cc @@ -286,7 +286,21 @@ static bool *get_DEC_mode( int param, Framebuffer *fb ) { void CSI_DECSM( Framebuffer *fb, Dispatcher *dispatch ) { for ( int i = 0; i < dispatch->param_count(); i++ ) { - bool *mode = get_DEC_mode( dispatch->getparam( i, 0 ), fb ); + int param = dispatch->getparam( i, 0 ); + + if ( (param == 1000) || (param == 1002) ) { + // clear the other mouse modes before setting this one + bool *c_mode = get_DEC_mode( 1000, fb ); + if ( c_mode ) { *c_mode = false; } + *c_mode = get_DEC_mode( 1002, fb ); + if ( c_mode ) { *c_mode = false; } + *c_mode = get_DEC_mode( 1005, fb ); + if ( c_mode ) { *c_mode = false; } + *c_mode = get_DEC_mode( 1006, fb ); + if ( c_mode ) { *c_mode = false; } + } + + bool *mode = get_DEC_mode( param, fb ); if ( mode ) { *mode = true; }