From a68ed67fb4985414248031c9098e8a5bdf5cc592 Mon Sep 17 00:00:00 2001 From: Miles Frain Date: Mon, 26 Oct 2020 20:04:48 -0700 Subject: [PATCH] Add inFront parameter to getMarkers --- example/src/Main.purs | 6 +++++- src/Ace/EditSession.js | 4 ++-- src/Ace/EditSession.purs | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/example/src/Main.purs b/example/src/Main.purs index f14c3ed..41f5912 100644 --- a/example/src/Main.purs +++ b/example/src/Main.purs @@ -12,6 +12,7 @@ import Ace.Editor as Editor import Ace.Ext.LanguageTools as LanguageTools import Ace.Ext.LanguageTools.Completer as Completer import Ace.KeyBinding as KeyBinding +import Ace.Marker as Marker import Ace.Range as Range import Ace.ScrollBar as ScrollBar import Ace.Search as Search @@ -20,7 +21,7 @@ import Ace.TokenIterator as TokenIterator import Ace.UndoManager as UndoManager import Data.Array.ST as AST import Data.Maybe (Maybe(..)) -import Data.Traversable (for_) +import Data.Traversable (for_, traverse) import Effect (Effect) import Effect.Console (log) import Effect.Ref as Ref @@ -352,6 +353,9 @@ miscTests = void do _ <- Session.documentToScreenColumn 0 0 session _ <- Session.documentToScreenRow 0 0 session _ <- Session.getScreenLength session + markers <- Session.getMarkers false session + markerIds <- traverse Marker.getId markers + log $ "markers " <> show markerIds Editor.selectMoreLines 0 editor Editor.setKeyboardHandler "" editor diff --git a/src/Ace/EditSession.js b/src/Ace/EditSession.js index 44b2504..1c90e33 100644 --- a/src/Ace/EditSession.js +++ b/src/Ace/EditSession.js @@ -549,9 +549,9 @@ exports.createImpl = create; exports.createFromLinesImpl = create; -exports.getMarkers = function (session) { +exports.getMarkersImpl = function (inFront, session) { return function () { - var markerObj = session.getMarkers(); + var markerObj = session.getMarkers(inFront); var ks = Object.getOwnPropertyNames(markerObj); var result = []; for (var i = 0; i < ks.length; i++) { diff --git a/src/Ace/EditSession.purs b/src/Ace/EditSession.purs index 45b7242..0158222 100644 --- a/src/Ace/EditSession.purs +++ b/src/Ace/EditSession.purs @@ -533,6 +533,7 @@ foreign import createFromLinesImpl :: Fn2 (Array String) (Nullable String) (Effe createFromLines :: Array String -> Maybe String -> Effect EditSession createFromLines text mode' = runFn2 createFromLinesImpl text (toNullable mode') +foreign import getMarkersImpl :: Fn2 Boolean EditSession (Effect (Array Marker)) -foreign import getMarkers - :: EditSession -> Effect (Array Marker) +getMarkers :: Boolean -> EditSession -> Effect (Array Marker) +getMarkers inFront session = runFn2 getMarkersImpl inFront session