Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxLHy0424 committed Nov 25, 2024
1 parent b3e419d commit e8057a7
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/console_ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class console_ui final {
short default_color, highlight_color, last_color;
COORD position;
callback_ fn;
auto set_color( short _color )
{
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), _color );
last_color = _color;
}
auto &operator=( const ui_item_ &_obj )
{
text = _obj.text;
Expand All @@ -54,11 +59,6 @@ class console_ui final {
fn = _obj.fn;
return *this;
}
auto set_color( short _color )
{
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), _color );
last_color = _color;
}
auto operator==( const COORD &_mouse_position ) const
{
return ( position.Y == _mouse_position.Y ) && ( position.X <= _mouse_position.X )
Expand Down Expand Up @@ -114,18 +114,21 @@ class console_ui final {
GetConsoleMode( GetStdHandle( STD_INPUT_HANDLE ), &attrs );
switch ( _mode ) {
case v_normal: {
attrs |= ENABLE_QUICK_EDIT_MODE, attrs |= ENABLE_INSERT_MODE,
attrs |= ENABLE_MOUSE_INPUT;
attrs |= ENABLE_QUICK_EDIT_MODE;
attrs |= ENABLE_INSERT_MODE;
attrs |= ENABLE_MOUSE_INPUT;
break;
}
case v_lock_text: {
attrs &= ~ENABLE_QUICK_EDIT_MODE, attrs &= ~ENABLE_INSERT_MODE,
attrs |= ENABLE_MOUSE_INPUT;
attrs &= ~ENABLE_QUICK_EDIT_MODE;
attrs &= ~ENABLE_INSERT_MODE;
attrs |= ENABLE_MOUSE_INPUT;
break;
}
case v_lock_all: {
attrs &= ~ENABLE_QUICK_EDIT_MODE, attrs &= ~ENABLE_INSERT_MODE,
attrs &= ~ENABLE_MOUSE_INPUT;
attrs &= ~ENABLE_QUICK_EDIT_MODE;
attrs &= ~ENABLE_INSERT_MODE;
attrs &= ~ENABLE_MOUSE_INPUT;
break;
}
}
Expand Down

0 comments on commit e8057a7

Please sign in to comment.