網頁

2013/05/30

Enabling Virtual Space mode use Notepad++

Delphi有個很好用的編輯功能:

我不會解釋……就是不管上下行字數有無相同,在按了上下鍵後游標都會在同一個位置上下跑。

我一直以為好用的Editor都應該會有這個功能,後來才發現……Notepad++沒有!

之後好久好久終於在Visual Studio看到了這個功能,中文名詞是:
啟用虛擬空間
英文是"Enabling Virtual Space mode"

後來在這個討論串中找到解法,節錄內容如下:
Sort of a hack (sends a window message directly to the Scintilla edit control on startup), but works great:
  1. Install NppExec plugin
  2. Go to Plugins -> NppExec -> Execute
  3. Enter the following code:
    // ensure console stays hidden
    NPP_CONSOLE 0
    
    // enable virtual spaces (cursor past end of line) outside column edit mode
    SCI_SENDMSG 2596 3 0
    
    // SCI_SENDMSG == send message to Scintilla edit control
    // 2596 == the message we're sending is SCI_SETVIRTUALSPACEOPTIONS
    // 3 == send the value (SCVS_RECTANGULARSELECTION | SCVS_USERACCESSIBLE)
    // the default value is 1 (just SCVS_RECTANGULARSELECTION) for
    //   virtual spaces in column select mode only
    // you can find these values by poking around the source code a bit, or
    // see http://www.scintilla.org/ScintillaDoc.html
    
  4. Click the Save button at the bottom, and give the script a name
  5. Now go to Plugins -> NppExec -> Advanced Options
  6. On the right, under "Execute this script when Notepad++ starts", select the script name you just saved
  7. Click OK, close/reopen Notepad++, and enjoy ;)

這方面還是外國人厲害啊!讚!

沒有留言:

張貼留言