sandip chitale's blog    Sandip Chitale's blog (scblog)
NOTE: I have moved many of my modules to NetBeans Plugin Portal . Please check there for latest versions of modules described on this blog.
20070128 Sunday January 28, 2007

UPDATED: LineTools module - Added select from, after, upto and to specified char actions

I have updated the Line Tools Module on my NetBeans update center described here.

What is new

Char Actions

Action Key bindingScreenshot
From Char Ctrl+Alt+, On MacOS Ctrl+Option+,Select from
After Char Ctrl+Alt+Shift+, On MacOS Ctrl+Option+Shift+,Select after
Upto Char Ctrl+Alt+Shift+. On MacOS Ctrl+Option+.Select upto
To Char Ctrl+Alt+. On MacOS Ctrl+Option+Shift+.

The char actions help you in selecting text from, after, upto or to the specified char (in a text field in the sidebar at the bottom of the editor) on the current line from the current caret position. You can use the char actions to either delete text (DELETE key), or modifying the text - uppercase (Alt+u u) or lowercase (Alt+u l) following the char action. These actions work somewhat like the t, T, f and F commands of Vi. You can type a numeric prefix nn, to find the nnth occurence of the char. If you are trying to operate on a digit you have to type ENTER key.

With the following text on the current line and caret at |

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ|
invoking From Char Ctrl+Alt+, On MacOS Ctrl+Option+,, specifying c and Match Case selected results in:
abcdefghijklmnopqrstuvwxyzAB|CDEFGHIJKLMNOPQRSTUVWXYZ
invoking From Char Ctrl+Alt+, On MacOS Ctrl+Option+,, specifying c and Match Case unselected results in:
ab|cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
invoking After Char Ctrl+Alt+Shift+, On MacOS Ctrl+Option+Shift+,, specifying c and Match Case selected results in:
abcdefghijklmnopqrstuvwxyzABC|DEFGHIJKLMNOPQRSTUVWXYZ
invoking After Char Ctrl+Alt+Shift+, On MacOS Ctrl+Option+Shift+,, specifying c and Match Case unselected results in:
abc|defghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

With the following text on the current line and caret at |

|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
invoking Upto Char Ctrl+Alt+Shift+. On MacOS Ctrl+Option+., specifying v and Match Case selected results in:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu|vwxyz
invoking Upto Char Ctrl+Alt+Shift+. On MacOS Ctrl+Option+., specifying v and Match Case unselected results in:
ABCDEFGHIJKLMNOPQRSTU|VWXYZabcdefghijklmnopqrstuvwxyz
invoking To Char Ctrl+Alt+. On MacOS Ctrl+Option+Shift+., specifying v and Match Case selected results in:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv|wxyz
invoking To Char Ctrl+Alt+. On MacOS Ctrl+Option+Shift+., specifying v and Match Case unselected results in:
ABCDEFGHIJKLMNOPQRSTUV|WXYZabcdefghijklmnopqrstuvwxyz

Sources

DISCLAIMER: This module is experimental. So no guarantees. Use the module at your own risk.


Posted by sandipchitale ( Jan 28 2007, 08:18:58 PM PST ) Permalink Comments [7]


Trackback URL: http://blogs.sun.com/scblog/entry/updated_linetools_module
Comments:

Great addition, as usual! I'll make myself accustomed to the keyboard shortcuts.

It would be cool if you could find a way to do incremental selection similar to your incremental search.

Maybe <Ctrl>+<Alt>+/ to select from the cursor to the end of a string in the text field.

And <Ctrl>+<Shift>+? to select from the cursor backwards to the to the start of a string in the text field.

Kind of like what 'v/' and 'v?' does in Vim.

Thanks again! :)

Posted by Jay Logan on January 28, 2007 at 09:56 PM PST #

Sandip, I've been happily using your line tools for some time now, especially the alt-up/down to move lines and shift-alt-up/down to copy lines. Unfortunately, while looking over the NB6-M7 improvements at http://wiki.netbeans.org/wiki/view/NewAndNoteWorthyMilestone7#section-NewAndNoteWorthyMilestone7-EditorImprovements, I see this: "New shortcuts for AST based selection. Press Alt+Shift+Up to expand the selection and Alt+Shift+Down to shrink the selection based on the structure of your Java source code." These might be nice, but won't they conflict with the alt-shift-up/down key-bindings in line tools? Bummer. I like the current line tools behavior better than the new M7 behavior. Do you have any plans to deal with this? Thanks.

Posted by Johnny Tolliver on February 19, 2007 at 06:04 AM PST #

Johnny,

Thanks for pointing this out. I faintly recall seeing this somewhere, may be on the page you pointed out. At minimum, I knew that they are trying to unify/revamp the key bindings.

Not to worry, some (important) parts of Line Tools functionality (and for that matter some of my other modules) is going to become part of core NetBeans. In any case, I will bring up this issue with the HIE (or whoever is working on the new key bindings).

Posted by Sandip on February 19, 2007 at 09:21 AM PST #

Sandip, first thanks for the good tool!
I would like to point 2 enhancements:
It would be nice to
  • be able to set the case sensitivity when sorting.
  • sort resource bundles also (easy when multiple developers update the same resource bundle using SVN, it avoids merge conflicts )
Best regards,
Thierry

Posted by De Leeuw on March 19, 2007 at 02:56 AM PDT #

Thierry,

Thanks.

About 1 - Good suggestion. I will look into it. About 2 - I think raw sorting should work. No? However if one needs to worry about correctly retaining comments and blank separator lines between groups of properties that is a more complex issue. May be able to do it by sorting such property groups.

Posted by Sandip on March 19, 2007 at 06:28 AM PDT #

Here's another idea. When using LineTools to move lines or blocks of lines, I'm normally moving lines into or out of an if-block or a try/catch or something like that. And probably 90% of the time I have to then follow the move with a Ctrl-T or Ctrl-D to get the indentation correct. Would it be useful/doable to automatically indent/unindent lines as they move into or out of a block of code marked by curly braces? It might be difficult to get this behavior to be perfect for all possible conditions, but as a start, moving up, over a } would indicate one level indent right. Moving down, over a } would indicate one level un-indent. Up, across a { would be unindent. Down, across { would be indent. That about covers it, though there might be corner cases that don't jump right out at me.

Posted by Johnny Tolliver on March 19, 2007 at 07:10 AM PDT #

Thierry,

I have added ability to control case sensitivity of sorting in Line Tools module. Enjoy!

Posted by Sandip, on March 25, 2007 at 04:30 PM PDT #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed








« July 2009
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today

Get NetBeans 5.5

Locations of visitors to this page

Today's Page Hits: 318


XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

scblog
scblog