Spine label editor: make ENTER at the end of a line move to next line
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Aug 2010 12:49:16 +0000 (12:49 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Aug 2010 12:49:16 +0000 (12:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17345 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/spine_labels.js

index 539a106..dd88df4 100644 (file)
                      * label
                      */
                     if (sel_start == sel_end) {
-                        /* Special case if the cursor is at the start of the line */
                         if (sel_start == 0) {
+                            /* If the cursor is at the start of the line:
+                             * insert new line
+                             */
                             line_value = ' ' + line_value;
+                        } else if (sel_start == line_value.length) {
+                            /* Special case if the cursor is at the end of the line:
+                             * move to next line
+                             */
+                            var next_row = $(row_id.prefix + (parseInt(row_id.spine) + 1));
+                            if (next_row) {
+                                next_row.focus();
+                            }
+                            break;
                         } else {
                             line_value = line_value.substr(0, sel_start) + ' ' + line_value.substr(sel_end);
                         }
                     }
                     break;
                 }
+
+                default : {
+                    break;
+                }
             }
         }