Skip to content

Commit

Permalink
git grep improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
antonvw committed Feb 9, 2025
1 parent 267cbb7 commit c265626
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 30 deletions.
4 changes: 2 additions & 2 deletions data/wex-menus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Name: wex-menus.xml
Purpose: setup of dynamic menus, like debuggers
and version control systems
Author: Anton van Wezenbeek
Copyright: (c) 2010-2024 Anton van Wezenbeek
Copyright: (c) 2010-2025 Anton van Wezenbeek
-->

<menus>
Expand Down Expand Up @@ -180,7 +180,7 @@ Copyright: (c) 2010-2024 Anton van Wezenbeek
<command type="ellipses"> &amp;commit </command>
<command type="ellipses-is-asked"> &amp;diff </command>
<command type="popup is-selected is-visual" menu="&amp;grep"> grep</command>
<command type="popup is-visual" menu="&amp;grep"> grep</command>
<command type="popup ellipses is-visual" menu="&amp;grep"> grep</command>
<command type="ellipses main"> &amp;help </command>
<command type="ellipses-is-asked"> &amp;log </command>
<!-- pull and push ask for password (should be asyc, not yet)
Expand Down
48 changes: 22 additions & 26 deletions src/stc/bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,26 @@ const std::string get_properties(
});
}

void marker_move(stc* stc, bool next)
{
auto line = next ? stc->MarkerNext(stc->get_current_line() + 1, 0xFFFF) :
stc->MarkerPrevious(stc->get_current_line() - 1, 0xFFFF);

if (line == -1)
{
line = next ? stc->MarkerNext(0, 0xFFFF) :
stc->MarkerPrevious(stc->get_line_count() - 1, 0xFFFF);
}

if (line != -1)
{
stc->goto_line(line);
}
else
{
log::status(_("No markers present"));
}
}
} // namespace wex

void wex::stc::bind_all()
Expand Down Expand Up @@ -426,37 +446,13 @@ void wex::stc::bind_all()

{[=, this](const wxCommandEvent& event)
{
auto line = MarkerNext(get_current_line() + 1, 0xFFFF);
if (line == -1)
{
line = MarkerNext(0, 0xFFFF);
}
if (line != -1)
{
goto_line(line);
}
else
{
log::status(_("No markers present"));
}
marker_move(this, true);
},
id::stc::marker_next},

{[=, this](const wxCommandEvent& event)
{
auto line = MarkerPrevious(get_current_line() - 1, 0xFFFF);
if (line == -1)
{
line = MarkerPrevious(get_line_count() - 1, 0xFFFF);
}
if (line != -1)
{
goto_line(line);
}
else
{
log::status(_("No markers present"));
}
marker_move(this, false);
},
id::stc::marker_previous}});

Expand Down
9 changes: 7 additions & 2 deletions src/vcs/vcs-entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,17 @@ bool wex::vcs_entry::execute(
dlg = new stc_entry_dialog(
std::string(),
_("Text") + ":",
wex::data::window(),
wex::data::window().title("git grep"),
wex::data::stc().flags(
wex::data::stc::window_t().set(wex::data::stc::WIN_SINGLE_LINE)));
}

dlg->ShowModal();
dlg->get_stc()->SetFocus();

if (dlg->ShowModal() == wxID_CANCEL)
{
return false;
}

text = dlg->get_stc()->get_text();

Expand Down

0 comments on commit c265626

Please sign in to comment.