Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Smart key "Home" #820

wants to merge 1 commit into from

2 participants


After press on button "Home" cursor should be moved to the begin of text on current line and only after second press to the begin of line


I'm testing this branch and i get the same behavior as master...

@habibutsu habibutsu closed this
@shuhaowu shuhaowu referenced this pull request from a commit
@shuhaowu shuhaowu Smart home key
This goes makes the home key go to the beginning of the current line
without the whitespace when it is pressed the first time and
when pressed a second time it goes to the beginning of the line.

Code review requested on the start of the line finding code. Is there a
more efficient way?

Actually addresses ninja-ide/ninja-ide#820
@shuhaowu shuhaowu referenced this pull request

Smart home key #890

@diegosarmentero diegosarmentero referenced this pull request from a commit
@diegosarmentero diegosarmentero Fixed Issue #820 5d40e09
@diegosarmentero diegosarmentero referenced this pull request

Fixed Issue #820 #893

@osscca osscca referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 4, 2012
  1. @habibutsu

    Smart key "Home"

    habibutsu authored
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 2 deletions.
  1. +11 −2 ninja_ide/gui/editor/
13 ninja_ide/gui/editor/
@@ -630,8 +630,17 @@ def __home_pressed(self, event):
move = QTextCursor.KeepAnchor
move = QTextCursor.MoveAnchor
- if self.textCursor().atBlockStart():
- self.moveCursor(QTextCursor.WordRight, move)
+ cursor = self.textCursor()
+ pos_current_selection = cursor.selectionEnd()
+ pos_current = cursor.position()
+ cursor.movePosition(QTextCursor.StartOfLine)
+ cursor.movePosition(QTextCursor.WordRight)
+ pos_start_text = cursor.position()
+ if pos_current != pos_start_text:
+ cursor.setPosition(pos_current_selection)
+ cursor.setPosition(pos_start_text, move)
+ self.setTextCursor(cursor)
return True
def __ignore_extended_line(self, event):
Something went wrong with that request. Please try again.