Sign in to follow this  
Followers 0

SciTE v 3.20 Beta available


151 posts in this topic

#141 ·  Posted

I would like to be able to toggle a bookmark (Ctrl + F2) by clicking the margin next to the line number.

Can this be done with the AutoIt package or do I need to request it be added to the original SciTE?

Share this post


Link to post
Share on other sites



#142 ·  Posted

I would like to be able to toggle a bookmark (Ctrl + F2) by clicking the margin next to the line number.

Can this be done with the AutoIt package or do I need to request it be added to the original SciTE?

I use the standard SciTE package released by Neil and are limiting the mods made, so this will feature have to come from there.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#143 ·  Posted

I use the standard SciTE package released by Neil and are limiting the mods made, so this will feature have to come from there.

Okay, I made a feature request but Neil rejected it because clicking in the margin is already used for selecting lines.

Given that SciTE can already detect margin clicks, could the bookmark toggling be added by a LUA script?

Share this post


Link to post
Share on other sites

#144 ·  Posted

I don't see why a double click on the margin couldn't toggle a bookmark keeping the current behavior of a single click selecting the line. That is analogous to Visual Studio's breakpoint toggle behavior which visually looks similar to a bookmark (though obviously different functionally).

As for Lua, there is an OnMarginClick() event that might be useful to implement the functionality.

Share this post


Link to post
Share on other sites

#145 ·  Posted

As for Lua, there is an OnMarginClick() event that might be useful to implement the functionality.

Thanks for the tip, Valik. After reading various documents, I have implemented similar functionality which I find to be quite satisfactory.

OnMarginClick() didn't work like I expected and caused too many problems, so I used OnDoubleClick(). Now when I double-click a line, a bookmark is toggled on/off for that line. I think this is just as good, if not better, than the margin clicking version found in Notepad++.

Here are the installation instructions for anyone that is interested. In anyone sees something I did wrong, please let me know.

In

C:\Program Files\AutoIt3\SciTE\LUA make a file named ToggleBookmark.lua, and put this code in that file.

--------------------------------------------------------------------------------
-- This library will enable bookmark toggling when double-clicking a line.
--------------------------------------------------------------------------------
ToggleBookmark = EventClass:new(Common)
function ToggleBookmark:OnDoubleClick()
    scite.MenuCommand(IDM_BOOKMARK_TOGGLE)
    return false
end

In the same directory, open SciTEStartup.lua and add this line after the others.

LoadLuaFile("ToggleBookmark.lua")

Restart SciTE, load a file, and double-click a line to see it in action. This script will work on any file and not just AutoIt scripts.

Is there somewhere outside of the scite source that I can find the menucommand IDs?

I'm not sure this qualifies as "outside of the scite source" but the Menu IDs are defined in SciTE.h which can be viewed here.

http://scintilla.hg.sourceforge.net/hgweb/scintilla/scite/file/tip/src/SciTE.h

Share this post


Link to post
Share on other sites

#146 ·  Posted

Hmmm, I double click to select entire words all the time. Is there a way to detect if the double click happened in the margin?

Share this post


Link to post
Share on other sites

#147 ·  Posted

Not that I could find. Simply replacing OnDoubleClick with OnMarginClick will toggle a bookmark when the margin is single-clicked. I encountered two problems with using OnMarginClick though.

First, folding points are in the margin, so toggling a fold will also toggle a bookmark at the same time.

The bigger problem was that I can't find any way to get the line number the margin was clicked at. The bookmark will always be toggled at the line where the caret is located. If the caret is at line 2 and you click the margin at line 5, the bookmark will be toggled at line 2.

Share this post


Link to post
Share on other sites

#148 ·  Posted

Can I add to SciTE some colors for specific words?

For example I added a new color for AutoIt Objects functions name but I want one more and for some reason doesn't work.

This is how it looks like au3.properties:

# Autoit keywords

keywords.$(au3)=$(au3.keywords.keywords)

# Autoit functions

keywords2.$(au3)=$(au3.keywords.functions)

# Autoit macros

keywords3.$(au3)=$(au3.keywords.macros)

# Autoit Send Keys

keywords4.$(au3)=$(au3.keywords.sendkeys)

# Pre-Processor

keywords5.$(au3)=$(au3.keywords.preprocessor)

# Special

keywords6.$(au3)=$(au3.keywords.special) $(autoit3wrapper.keywords.special)

# Expand abbreviations

keywords7.$(au3)=$(au3.keywords.abbrev)

# UDFS

keywords8.$(au3)=$(au3.keywords.udfs) $(au3.keywords.user.udfs)

# AutoIt Objects

keywords9.$(au3)=$(au3.keywords.obj)

#Background

style.au3.32=style.*.32=$(font.base),back:#F0F4F9

# Brace highlight

style.au3.34=fore:#0000FF,bold,back:#F0F4F9

# Brace incomplete highlight

style.au3.35=fore:#009933,italics,back:#F0F4F9

# White space

style.au3.0=fore:#000000,back:#F0F4F9

# Comment line

style.au3.1=fore:#009933,italics

# Comment block

style.au3.2=fore:#669900,italics

# Number

style.au3.3=fore:#AC00A9,bold,italics

# Function

style.au3.4=fore:#000090,bold,italics

# Keyword

style.au3.5=fore:#0000FF,bold

# Macro

style.au3.6=fore:#FF33FF,bold

# String

style.au3.7=fore:#9999CC,bold

# Operator

style.au3.8=fore:#FF0000,bold

# Variable

style.au3.9=fore:#AA0000,bold

# Sent keys in string

style.au3.10=fore:#FF8800,bold

# Pre-Processor

style.au3.11=fore:#F000FF,italics

# Special

style.au3.12=fore:#A00FF0,italics

# Expand abbreviations

style.au3.13=fore:#FF0000,bold

# Com Objects

style.au3.14=fore:#0000FF,bold,italics

#Standard UDF's

style.au3.15=fore:#0080FF,italics,bold

# AutoIt Objects

style.au3.16=fore:#808080,italics,bold

I tried to add new lines like below but without success:

# Others

keywords10.$(au3)=$(au3.keywords.others)

# Others

style.au3.17=fore:#FF8000,italics,bold

Any idea?

When the words fail... music speaks

Share this post


Link to post
Share on other sites

#149 ·  Posted

You don't just add new keywords and the lexer magically knows what to do. If Jos has not written support for 9 different sets of keywords then you are confined to 8 sets.

Share this post


Link to post
Share on other sites

#150 ·  Posted (edited)

Updated SciTE beta to v3.20 released recently.

See first post.

Edited by Jos
1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this  
Followers 0