]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
- add support to snack for cursorAtEnd in entry (Shawn Starr)
authormlichvar <mlichvar>
Wed, 13 Jun 2007 17:17:53 +0000 (17:17 +0000)
committermlichvar <mlichvar>
Wed, 13 Jun 2007 17:17:53 +0000 (17:17 +0000)
newt.spec
snack.py
snackmodule.c

index a88923b7a23f086d876477178e571378a12f54b7..9a96c2825386e07da7d247dd8bc5b8a798c6b7ab 100644 (file)
--- a/newt.spec
+++ b/newt.spec
@@ -88,8 +88,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libnewt.a
 
 %changelog
-- add support for listbox multiple selection and border to snack
-  (patch by Shawn Starr)
+- add support to snack for multiple selection and border in listbox
+  and cursorAtEnd in entry (patch by Shawn Starr)
 - fix scrollbar positioning in listbox
 - cope with backward system time jumps (#240691)
 - free helplines and windows in newtFinished, check for overflow (#239992)
index e40515bde334b205e6288e501f4a95a1c7e867cf..e763650c8212ab0cb422f4cf4eb6b93419a21c0c 100644 (file)
--- a/snack.py
+++ b/snack.py
@@ -268,14 +268,14 @@ class Entry(Widget):
           if returnExit is set, return from Form when exiting this element, else
            proceed to next entry widget.
      - value(self): return value.
-     - set(text) : set the text
+     - set(text, cursorAtEnd = 1) : set the text
      - setFlags (flag, sense) : flags can be FLAG_DISABLED, FLAGS_SET, FLAGS_RESET, FLAGS_TOGGLE
     """
     def value(self):
         return self.w.entryValue
 
-    def set(self, text):
-        return self.w.entrySetValue(text)
+    def set(self, text, cursorAtEnd = 1):
+        return self.w.entrySetValue(text, cursorAtEnd)
 
     def setFlags (self, flag, sense):
         return self.w.entrySetFlags(flag, sense)
index 3a47a3d26aa2e6b23cb4010f4e37dc2f0e0d70cf..da3368af2931f815896dbe7090a5b9a7959596e4 100644 (file)
@@ -973,11 +973,12 @@ static PyObject * widgetAddCallback(snackWidget * s, PyObject * args) {
 
 static PyObject * widgetEntrySetValue(snackWidget * s, PyObject * args) {
     char * val;
+    int cursorAtEnd = 1;
 
-    if (!PyArg_ParseTuple(args, "s", &val))
+    if (!PyArg_ParseTuple(args, "s|i", &val, &cursorAtEnd))
        return NULL;
 
-    newtEntrySet(s->co, val, 1);
+    newtEntrySet(s->co, val, cursorAtEnd);
 
     Py_INCREF(Py_None);
     return Py_None;