Re: PATCH: support Insert spaces instead of tabs




Hi,

Is already in bugzilla (bug 542817).

Thanks,
Yaniv

Hi Yaniv, I'll need to examine it more closely, but in principle yes
it'll go in.
I'm just suggesting working in bugzilla so it doesn't get lost.

Stephen.

On Sat, Aug 30, 2008 at 2:08 PM, kpub <kpub actcom net il> wrote:
Hi Stephen,

What about this patch? Are you going to apply it?

Thanks,
Yaniv

Thanks Yaniv, looks good. Can you file a bug in bugzilla and attach it
there? It's
easier to track and discuss that way.

Stephen.

On Sat, Jul 12, 2008 at 3:53 PM, kpub <kpub actcom net il> wrote:

Hi,

Following a patch that add  "spaces instead of tabs" option in case where
sourceview is available.

Thanks for the great work
Yaniv Kamay


Index: glade2/meldapp.glade
===================================================================
--- glade2/meldapp.glade    (revision 1022)
+++ glade2/meldapp.glade    (working copy)
@@ -1387,6 +1387,22 @@
                                </packing>
                              </child>
                              <child>
+                                  <widget class="GtkCheckButton"
id="checkbutton_spaces_instead_of_tabs">
+                                    <property
name="visible">True</property>
+                                    <property
name="can_focus">True</property>
+                                    <property name="label"
translatable="yes">Insert spaces instead of tabs</property>
+                                    <property
name="use_underline">True</property>
+                                    <property
name="response_id">0</property>
+                                    <property
name="draw_indicator">True</property>
+                                    <signal name="toggled"
handler="on_checkbutton_spaces_instead_of_tabs_toggled"/>
+                                  </widget>
+                                  <packing>
+                                    <property
name="expand">False</property>
+                                    <property
name="fill">False</property>
+                                    <property
name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
                                <widget class="GtkHBox" id="hbox38">
                                  <property
name="visible">True</property>
                                  <child>
@@ -1416,7 +1432,7 @@
                                <packing>
                                  <property
name="expand">False</property>
                                  <property name="fill">False</property>
-                                    <property
name="position">1</property>
+                                    <property
name="position">2</property>
                                </packing>
                              </child>
                              <child>
@@ -1432,7 +1448,7 @@
                                <packing>
                                  <property
name="expand">False</property>
                                  <property name="fill">False</property>
-                                    <property
name="position">2</property>
+                                    <property
name="position">3</property>
                                </packing>
                              </child>
                              <child>
@@ -1448,7 +1464,7 @@
                                <packing>
                                  <property
name="expand">False</property>
                                  <property name="fill">False</property>
-                                    <property
name="position">3</property>
+                                    <property
name="position">4</property>
                                </packing>
                              </child>
                              <child>
@@ -1464,7 +1480,7 @@
                                <packing>
                                  <property
name="expand">False</property>
                                  <property name="fill">False</property>
-                                    <property
name="position">4</property>
+                                    <property
name="position">5</property>
                                </packing>
                              </child>
                            </widget>
Index: filediff.py
===================================================================
--- filediff.py    (revision 1022)
+++ filediff.py    (working copy)
@@ -95,6 +95,8 @@
          for v in self.textview:
              v.set_buffer( gsv.SourceBuffer() )
              v.set_show_line_numbers(self.prefs.show_line_numbers)
+
 v.set_insert_spaces_instead_of_tabs(self.prefs.spaces_instead_of_tabs)
+                v.set_tabs_width(self.prefs.tab_size)
      self.keymask = 0
      self.load_font()
      self.deleted_lines_pending = -1
@@ -306,6 +308,9 @@
              tabs.set_tab(i, pango.TAB_LEFT,
i*value*self.pango_char_width)
          for i in range(3):
              self.textview[i].set_tabs(tabs)
+            if sourceview_available:
+                for t in self.textview:
+                    t.set_tabs_width(value)
      elif key == "use_custom_font" or key == "custom_font":
          self.load_font()
      elif key == "show_line_numbers":
@@ -323,6 +328,10 @@
          self._update_regexes()
      elif key == "edit_wrap_lines":
          [t.set_wrap_mode( self.prefs.edit_wrap_lines ) for t in
self.textview]
+        elif key == "spaces_instead_of_tabs":
+            if sourceview_available:
+                for t in self.textview:
+                    t.set_insert_spaces_instead_of_tabs(value)

  def on_key_press_event(self, object, event):
      x = self.keylookup.get(event.keyval, 0)
Index: meldapp.py
===================================================================
--- meldapp.py    (revision 1022)
+++ meldapp.py    (working copy)
@@ -234,10 +234,16 @@
          self.radiobutton_gnome_font.set_active(1)
      self.fontpicker.set_font_name( self.prefs.custom_font )
      self.spinbutton_tabsize.set_value( self.prefs.tab_size )
+        if sourceview_available:
+            self.checkbutton_spaces_instead_of_tabs.set_active(
self.prefs.spaces_instead_of_tabs )
+            self.checkbutton_show_line_numbers.set_active(
self.prefs.show_line_numbers )
+            self.checkbutton_use_syntax_highlighting.set_active(
self.prefs.use_syntax_highlighting )
+        else:
+            self.checkbutton_spaces_instead_of_tabs.set_sensitive(False)
+            self.checkbutton_show_line_numbers.set_sensitive(False)
+
 self.checkbutton_use_syntax_highlighting.set_sensitive(False)
      self.option_wrap_lines.set_history( self.prefs.edit_wrap_lines )
      self.checkbutton_supply_newline.set_active(
self.prefs.supply_newline
)
-        self.checkbutton_show_line_numbers.set_active(
self.prefs.show_line_numbers )
-        self.checkbutton_use_syntax_highlighting.set_active(
self.prefs.use_syntax_highlighting )
      self.editor_command[
self.editor_radio_values.get(self.prefs.edit_command_type, "internal")
].set_active(1)
      self.gnome_default_editor_label.set_text( "(%s)" % "
".join(self.prefs.get_gnome_editor_command([])) )
      self.custom_edit_command_entry.set_text( "
".join(self.prefs.get_custom_editor_command([])) )
@@ -279,6 +285,10 @@
          self.prefs.use_custom_font = custom
  def on_spinbutton_tabsize_changed(self, spin):
      self.prefs.tab_size = int(spin.get_value())
+    def on_checkbutton_spaces_instead_of_tabs_toggled(self, check):
+        self.prefs.spaces_instead_of_tabs = check.get_active()
+        if check.get_active() and not sourceview_available:
+            misc.run_dialog(_("Spaces instead of_tab is only available
if
you have gnome-python-desktop installed.") )
  def on_option_wrap_lines_changed(self, option):
      self.prefs.edit_wrap_lines = option.get_history()
  def on_checkbutton_supply_newline_toggled(self, check):
@@ -415,6 +425,7 @@
      "use_custom_font": prefs.Value(prefs.BOOL,0),
      "custom_font": prefs.Value(prefs.STRING,"monospace, 14"),
      "tab_size": prefs.Value(prefs.INT, 4),
+        "spaces_instead_of_tabs": prefs.Value(prefs.BOOL, False),
      "show_line_numbers": prefs.Value(prefs.BOOL, 0),
      "use_syntax_highlighting": prefs.Value(prefs.BOOL, 0),
      "edit_wrap_lines" : prefs.Value(prefs.INT, 0),

_______________________________________________
meld-list mailing list
meld-list gnome org
http://mail.gnome.org/mailman/listinfo/meld-list






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]