Permalink
Browse files

When clicking in the gutter to select full lines, always give the Edi…

…tor the focus (so it doesn't stay in the Project Pane, for instance.)
  • Loading branch information...
1 parent bf0e65f commit 1a4a5a686e848bb2ce888d60dcede95a4af80569 @adamv adamv committed Jun 27, 2009
Showing with 12 additions and 12 deletions.
  1. +11 −11 src/GutterCtrl.cpp
  2. +1 −1 src/Lines.h
View
@@ -408,6 +408,7 @@ void GutterCtrl::OnMouseLeftDown(wxMouseEvent& event) {
m_currentSel = lines.AddSelection(startpos, endpos);
lines.SetPos(endpos);
+ m_editorCtrl.SetFocus();
m_sel_startline = m_sel_endline = line_id;
}
@@ -421,6 +422,7 @@ void GutterCtrl::OnMouseLeftDown(wxMouseEvent& event) {
if (hasSelection) {
m_currentSel = lines.AddSelection(sel.start, lines.GetLength());
lines.SetPos(lines.GetLength());
+ m_editorCtrl.SetFocus();
}
}
@@ -538,9 +540,8 @@ void GutterCtrl::OnMouseMotion(wxMouseEvent& event) {
m_editorCtrl.DrawLayout();
}
}
- else if (event.GetX() > (int)m_foldStartX && y >= 0 && y < lines.GetHeight()) {
+ else if (event.GetX() > (int)m_foldStartX && 0 <=y && y < lines.GetHeight()) {
const unsigned int line_id = lines.GetLineFromYPos(y);
-
vector<cxFold*> foldStack = m_editorCtrl.GetFoldStack(line_id);
if (!foldStack.empty()) {
m_currentFold = foldStack.back();
@@ -563,17 +564,16 @@ void GutterCtrl::OnMouseLeave(wxMouseEvent& WXUNUSED(event)) {
}
void GutterCtrl::OnMouseLeftUp(wxMouseEvent& WXUNUSED(event)) {
- //wxLogDebug("OnMouseLeftUp");
- if (!HasCapture()) return;
-
- // Reset state variables
- m_currentSel = -1;
+ if (HasCapture()) {
+ // Reset state variables
+ m_currentSel = -1;
- // Release the capure made in OnMouseLeftDown()
- ReleaseMouse();
+ // Release the capure made in OnMouseLeftDown()
+ ReleaseMouse();
- // Redraw gutter to remove highlights
- DrawGutter();
+ // Redraw gutter to remove highlights
+ DrawGutter();
+ }
}
void GutterCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) {
View
@@ -1,7 +1,7 @@
#ifndef LINES_H
#define LINES_H
-#include "wx/wxprec.h" // For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
#include "Catalyst.h"
#include "FixedLine.h"
#include "LineListWrap.h"

0 comments on commit 1a4a5a6

Please sign in to comment.