Skip to content

Commit

Permalink
stc context menu only shown if no selection active
Browse files Browse the repository at this point in the history
  • Loading branch information
antonvw committed Sep 21, 2024
1 parent a4ba567 commit add4262
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Changed

- wex::quoted uses std::quoted and includes a delim character
- stc context menu and properties only shown if no selection active

### Fixed

Expand Down
10 changes: 7 additions & 3 deletions src/stc/bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,11 @@ void wex::stc::bind_all()

void wex::stc::build_popup_menu(menu& menu)
{
if (get_current_line() == 0 && !lexers::get()->get_lexers().empty())
const auto sel(GetSelectedText().ToStdString());

if (
get_current_line() == 0 && sel.empty() &&
!lexers::get()->get_lexers().empty())
{
menu.append({{id::stc::show_properties, _("Properties")}});
}
Expand Down Expand Up @@ -475,8 +479,8 @@ void wex::stc::build_popup_menu(menu& menu)
// Folding if nothing selected, property is set,
// and we have a lexer.
if (
GetSelectedText().ToStdString().empty() && GetProperty("fold") == "1" &&
get_lexer().is_ok() && !get_lexer().scintilla_lexer().empty())
sel.empty() && GetProperty("fold") == "1" && get_lexer().is_ok() &&
!get_lexer().scintilla_lexer().empty())
{
menu.append(
{{},
Expand Down

0 comments on commit add4262

Please sign in to comment.