Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ui: show the current column in the commit message editor

This adds a column number label to the commit message editor to show
the column position of the text cursor.  This is useful since the commit
message editor is a WYSIWG editor for commit messages.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information...
commit ac1a2bd17b2426f01f6ecf338608db55aa1e47a6 1 parent e89bac1
@davvid davvid authored
Showing with 19 additions and 1 deletion.
  1. +9 −1 cola/views/__init__.py
  2. +10 −0 ui/main.ui
View
10 cola/views/__init__.py
@@ -94,6 +94,11 @@ def init(self, parent=None):
SIGNAL('clicked(bool)'),
self.handle_vertical_checkbox)
+ # Display the current column
+ self.connect(self.commitmsg,
+ SIGNAL('cursorPositionChanged()'),
+ self.show_current_column)
+
def handle_vertical_checkbox(self, checked):
if checked:
self.splitter.setOrientation(Qt.Vertical)
@@ -145,10 +150,13 @@ def selected_line(self):
offset -= 1
line, rest = contents[offset:].split('\n', 1)
return line
-
def display(self, text):
self.set_display(text)
self.diff_dock.raise_()
+ def show_current_column(self):
+ cursor = self.commitmsg.textCursor()
+ colnum = cursor.columnNumber()
+ self.column_label.setText('Column: %02d' % colnum)
class LogView(CreateStandardView(Ui_logger, QDialog)):
"""A simple dialog to display command logs."""
View
10 ui/main.ui
@@ -671,6 +671,16 @@
</property>
</spacer>
</item>
+ <item>
+ <widget class="QLabel" name="column_label" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
Please sign in to comment.
Something went wrong with that request. Please try again.