<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Column mode smart selection shortcut]]></title><description><![CDATA[<p dir="auto">I’m trying to find a way to improve my usage of the Column mode option, thus I’m in the need of something like this:<br />
<img src="https://camo.nodebb.org/93d0eca239021696224d3a12f81ddc552b8e4ae3?url=https%3A%2F%2Fi.imgur.com%2FPmB9rtE.gif" alt="a" class=" img-fluid img-markdown" /></p>
<p dir="auto">Basically, move the carret up (or down) until it hits the “top” (or “bottom”) so I don’t have to press Alt+Shift that many times, or use the mouse, god forbid. A “smart” column mode selection if you will. It would be even more helpful if also worked like that:<br />
<img src="https://camo.nodebb.org/2f7816ac8f48e7f0df27f79c94d6221ebf3f6a5b?url=https%3A%2F%2Fi.imgur.com%2FAftaFc4.gif" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">In other words, move upwards until either the line doesn’t go that far or the left or right character is different from those at the initial position. Or at least it’s how I think a script should handle it. Yes, a script, I think that’s the only way… Although it would be nice to have it as a standard feature, I’m sure other people would find it useful.</p>
<p dir="auto">So before I dabble in python or lua or something, if anyone could point me in the right direction, preferably a easier way or “it’s already been done, stupid” I’d appreciate.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/25574/column-mode-smart-selection-shortcut</link><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 20:00:10 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/25574.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Mar 2024 12:31:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Column mode smart selection shortcut on Fri, 15 Mar 2024 20:43:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> said in <a href="/post/93574">Column mode smart selection shortcut</a>:</p>
<blockquote>
<p dir="auto">Shouldn’t that be 42 instead?</p>
</blockquote>
<p dir="auto">That just selects everything. And by “everything,” I mean <em>everything:</em> life, the universe, etc.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93599</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93599</guid><dc:creator><![CDATA[pbarney]]></dc:creator><pubDate>Fri, 15 Mar 2024 20:43:44 GMT</pubDate></item><item><title><![CDATA[Reply to Column mode smart selection shortcut on Fri, 15 Mar 2024 07:47:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/notdodgeball" aria-label="Profile: notdodgeball">@<bdi>notdodgeball</bdi></a> said in <a href="/post/93537">Column mode smart selection shortcut</a>:</p>
<blockquote>
<p dir="auto">I thought putting it as 69 would make it clear but yes</p>
</blockquote>
<p dir="auto">Shouldn’t that be 42 instead? ;-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93574</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93574</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 15 Mar 2024 07:47:06 GMT</pubDate></item><item><title><![CDATA[Reply to Column mode smart selection shortcut on Wed, 13 Mar 2024 19:25:48 GMT]]></title><description><![CDATA[<pre><code>if editor.getSelectionEmpty():
  
  currentLine = editor.lineFromPosition(editor.getCurrentPos())
  currentLineLength = editor.lineLength(currentLine)
  currentPos = editor.getCurrentPos()
  currentCol = editor.getColumn(currentPos)
  currentLineStart = editor.positionFromLine(currentLine)
  
  currentHorizontalPos = currentPos - currentLineStart
  currentRChar = editor.getTextRange(currentPos, currentPos + 1)
  currentLChar = editor.getTextRange(currentPos, currentPos - 1)
  
  count = 0
  while True:
    
    count += 1
    previousLine = currentLine-count
    previousLineStart = editor.positionFromLine(previousLine)
    previousLineLength = editor.lineLength(previousLine)
    previousPos = editor.findColumn(previousLine,currentCol)
    previousCol = editor.getColumn(previousPos)
    
    previousRChar = editor.getTextRange(previousPos, previousPos + 1)
    previousLChar = editor.getTextRange(previousPos, previousPos - 1)
    
    if currentRChar != previousRChar or currentLChar != previousLChar or previousCol != currentCol:
      break
    
    editor.addSelection(previousPos,previousPos)

</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/93544</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93544</guid><dc:creator><![CDATA[notdodgeball]]></dc:creator><pubDate>Wed, 13 Mar 2024 19:25:48 GMT</pubDate></item><item><title><![CDATA[Reply to Column mode smart selection shortcut on Tue, 12 Mar 2024 20:45:43 GMT]]></title><description><![CDATA[<p dir="auto">Yeah, I know, I thought putting it as 69 would make it clear but yes, you are right.</p>
<p dir="auto">Regardless, I was putting it into use and it’s actually worse than that. When the file has tabs, getCurrentPos() it does not line up as the position varies depending on the tabulation. How do circumvent it? I assume getColumn() might help looking at the docs. Hum…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93537</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93537</guid><dc:creator><![CDATA[notdodgeball]]></dc:creator><pubDate>Tue, 12 Mar 2024 20:45:43 GMT</pubDate></item><item><title><![CDATA[Reply to Column mode smart selection shortcut on Tue, 12 Mar 2024 20:33:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/notdodgeball" aria-label="Profile: notdodgeball">@<bdi>notdodgeball</bdi></a><br />
To expand on why <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said the number <code>69</code> is “oustandingly bad”:</p>
<p dir="auto">It’s (usually) bad practice to include “magic numbers” like <code>69</code> in your code with no explanation as to why you chose that number. Better to declare a global constant (preferably with an explanatory comment) like so, and then reference it later on in the code:</p>
<pre><code class="language-py"># I'm using a proprietary file format where every file has 69 lines
MY_MAGIC_NUMBER = 69
...
...
for x in range(1, MY_MAGIC_NUMBER):
</code></pre>
<p dir="auto">That may reduce your confusion weeks later when you stumble across this script and wonder what the hell it’s supposed to do.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93536</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93536</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Tue, 12 Mar 2024 20:33:37 GMT</pubDate></item><item><title><![CDATA[Reply to Column mode smart selection shortcut on Tue, 12 Mar 2024 20:12:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/notdodgeball" aria-label="Profile: notdodgeball">@<bdi>notdodgeball</bdi></a> said in <a href="/post/93534">Column mode smart selection shortcut</a>:</p>
<blockquote>
<p dir="auto">if there is something outstandingly bad</p>
</blockquote>
<p dir="auto">Probably this is a leading candidate:</p>
<blockquote>
<p dir="auto">69</p>
</blockquote>
]]></description><link>https://community.notepad-plus-plus.org/post/93535</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93535</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 12 Mar 2024 20:12:56 GMT</pubDate></item><item><title><![CDATA[Reply to Column mode smart selection shortcut on Tue, 12 Mar 2024 20:11:03 GMT]]></title><description><![CDATA[<p dir="auto">Ok, my first python script:</p>
<pre><code>if editor.getSelectionEmpty():

  currentLine = editor.lineFromPosition(editor.getCurrentPos())
  currentLineLength = editor.lineLength(currentLine)
  currentLineStart = editor.positionFromLine(currentLine)
  
  currentPos = editor.getCurrentPos()
  currentHorizontalPos = currentPos - currentLineStart
  currentChar = editor.getTextRange(currentPos, currentPos + 1)

  for x in range(1, 69):
    previousLineStart = editor.positionFromLine(currentLine-x)
    previousLinelength = editor.lineLength(currentLine-x)
    
    if editor.lineLength(currentLine-x) &lt; currentHorizontalPos:
      break
    
    previousLineSamePosition = previousLineStart + currentHorizontalPos
    previousChar = editor.getTextRange(previousLineSamePosition, previousLineSamePosition + 1)

    if currentChar != previousChar:
      break
    else:
      editor.addSelection(previousLineSamePosition,previousLineSamePosition)
</code></pre>
<p dir="auto">There is better ways to do it, I assume, but it worked so far. Please tell me if there is something outstandingly bad.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93534</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93534</guid><dc:creator><![CDATA[notdodgeball]]></dc:creator><pubDate>Tue, 12 Mar 2024 20:11:03 GMT</pubDate></item><item><title><![CDATA[Reply to Column mode smart selection shortcut on Tue, 12 Mar 2024 13:40:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/notdodgeball" aria-label="Profile: notdodgeball">@<bdi>notdodgeball</bdi></a> said in <a href="/post/93523">Column mode smart selection shortcut</a>:</p>
<blockquote>
<p dir="auto">so I don’t have to press Alt+Shift that many times</p>
</blockquote>
<p dir="auto">Well, there’s this that <em>may</em> help:</p>
<p dir="auto"><img src="/assets/uploads/files/1710250795725-dd2a3038-6b1d-49e2-bf82-e5c0f73338af-image.png" alt="dd2a3038-6b1d-49e2-bf82-e5c0f73338af-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">User manual <a href="https://npp-user-manual.org/docs/editing/#:~:text=then%20execute%20the-,Begin/End%20Select%20in%20Column%20Mode,-command%3B%20move%20caret" rel="nofollow ugc">ref.</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93524</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93524</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 12 Mar 2024 13:40:57 GMT</pubDate></item></channel></rss>