GithubHelp home page GithubHelp logo

Comments (13)

darkfrog26 avatar darkfrog26 commented on September 21, 2024 1

Here's what I'm thinking:

  • Detect rows (currently adding this for some new features) and columns
  • If columns is less than minimumColumns (defaults to 10), the column count will be set to maximumColumns (defaults to 5000 to essentially disable breaking)

Any thoughts?

from scribe.

s5bug avatar s5bug commented on September 21, 2024

The issue also occurs any time the application is being run from SBT, whether it's from IntelliJ or externally. Before the stack trace is printed, a few warnings are given:

[error] Nov 17, 2022 3:54:46 AM org.jline.utils.Log logr
[error] WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
Full stack trace
[error] java.lang.StringIndexOutOfBoundsException: begin 0, end -3, length 56
[error]         at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4604)
[error]         at java.base/java.lang.String.substring(String.java:2707)
[error]         at scribe.output.TextOutput$.splitAt$extension(LogOutput.scala:32)
[error]         at scribe.output.TextOutput.splitAt(LogOutput.scala:32)
[error]         at scribe.format.FormatBlock$MultiLine.$anonfun$format$11(FormatBlock.scala:313)
[error]         at scala.collection.immutable.List.flatMap(List.scala:293)
[error]         at scribe.format.FormatBlock$MultiLine.format(FormatBlock.scala:309)
[error]         at scribe.format.FormatBlocksFormatter.$anonfun$format$1(FormatBlocksFormatter.scala:8)
[error]         at scala.collection.immutable.List.map(List.scala:250)
[error]         at scribe.format.FormatBlocksFormatter.format(FormatBlocksFormatter.scala:8)
[error]         at scribe.handler.SynchronousLogHandle$.$anonfun$log$1(SynchronousLogHandle.scala:8)
[error]         at scribe.handler.SynchronousLogHandle$.$anonfun$log$1$adapted(SynchronousLogHandle.scala:7)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.handler.SynchronousLogHandle$.log(SynchronousLogHandle.scala:7)
[error]         at scribe.handler.LogHandlerBuilder.log(LogHandlerBuilder.scala:14)
[error]         at scribe.Logger.$anonfun$logInternal$2(Logger.scala:131)
[error]         at scribe.Logger.$anonfun$logInternal$2$adapted(Logger.scala:131)
[error]         at scala.collection.immutable.List.foreach(List.scala:333)
[error]         at scribe.Logger.$anonfun$logInternal$1(Logger.scala:131)
[error]         at scribe.Logger.$anonfun$logInternal$1$adapted(Logger.scala:130)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.logInternal(Logger.scala:130)
[error]         at scribe.Logger.$anonfun$logInternal$4(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$4$adapted(Logger.scala:132)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.$anonfun$logInternal$1(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$1$adapted(Logger.scala:130)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.logInternal(Logger.scala:130)
[error]         at scribe.Logger.$anonfun$logInternal$4(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$4$adapted(Logger.scala:132)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.$anonfun$logInternal$1(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$1$adapted(Logger.scala:130)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.logInternal(Logger.scala:130)
[error]         at scribe.Logger.$anonfun$logInternal$4(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$4$adapted(Logger.scala:132)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.$anonfun$logInternal$1(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$1$adapted(Logger.scala:130)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.logInternal(Logger.scala:130)
[error]         at scribe.Logger.$anonfun$logInternal$4(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$4$adapted(Logger.scala:132)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.$anonfun$logInternal$1(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$1$adapted(Logger.scala:130)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.logInternal(Logger.scala:130)
[error]         at scribe.Logger.$anonfun$logInternal$4(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$4$adapted(Logger.scala:132)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.$anonfun$logInternal$1(Logger.scala:132)
[error]         at scribe.Logger.$anonfun$logInternal$1$adapted(Logger.scala:130)
[error]         at scala.Option.foreach(Option.scala:437)
[error]         at scribe.Logger.logInternal(Logger.scala:130)
[error]         at scribe.Logger.log(Logger.scala:119)
[error]         at scribe.ScribeImpl$.$anonfun$log$extension$1(ScribeImpl.scala:9)
[error]         at delay @ scribe.ScribeImpl$.log$extension(ScribeImpl.scala:9)
[error]         at defer @ scribe.ScribeImpl$.log$extension(ScribeImpl.scala:13)
[error]         at defer @ scribe.ScribeImpl$.log$extension(ScribeImpl.scala:13)

from scribe.

darkfrog26 avatar darkfrog26 commented on September 21, 2024

@s5bug ah, interesting. I'm actually in the process of making some changes to this logic, so the timing of this bug is very much appreciated. :) The warning is known and locally I've already removed JLine entirely in favor of tput, but it sounds like tput isn't reporting properly in certain circumstances either. What's especially strange is why it would say "1" instead of "0" or "-1". Is it consistently reporting "1"?

from scribe.

darkfrog26 avatar darkfrog26 commented on September 21, 2024

Also, would you rather, when not able to be detected, I set a default like 120 characters or do I think I just just disable alignment?

from scribe.

darkfrog26 avatar darkfrog26 commented on September 21, 2024

See: https://github.com/outr/scribe/blob/master/core/jvm/src/main/scala/scribe/Platform.scala#L13-L17

from scribe.

s5bug avatar s5bug commented on September 21, 2024

I am in favor of your proposed behavior! I don't know why tput is reporting 1, but it was consistent across my 3 debug runs...

from scribe.

s5bug avatar s5bug commented on September 21, 2024

I would prefer Scribe not pollute my home directory, instead opting for a cache directory:

private lazy val scriptFile = new File(System.getProperty("user.home"), ".cursor-position.sh")
. XDG_CACHE_HOME on systems that support it, %LocalAppData%/scribe on Windows, etc. Especially since it can recreate the file.

Also, I believe that one can remove the -c on L109, in turn allowing for the shebang to be dropped on L95. Windows bash doesn't live at /bin/bash, so I don't know whether that shebang would cause problems or not.

from scribe.

darkfrog26 avatar darkfrog26 commented on September 21, 2024

I've removed the -c and shebang and it still works. Regarding the script file location, I've changed it to ~/.cache/scribe/cursor-position.sh instead. I think that's a better option on *nix but I'm not sure how well that will go on Windows. Honestly, I suspect this won't work on Windows anyway since I doubt tput is available in general.

from scribe.

darkfrog26 avatar darkfrog26 commented on September 21, 2024

New release with these changes: https://github.com/outr/scribe/releases/tag/3.10.5

from scribe.

darkfrog26 avatar darkfrog26 commented on September 21, 2024

Please close this issue after you've had a chance to verify this works.

from scribe.

s5bug avatar s5bug commented on September 21, 2024

It does work!

from scribe.

s5bug avatar s5bug commented on September 21, 2024

As for caches, perhaps it's worth making something that looks for {XDG_CACHE_HOME}/scribe on Linux, {CSIDL_LOCAL_APPDATA}/scribe on Windows. Mac seems to not have an environment variable and {user.home}/Library/Caches/com.outr.scribe is fine.

A good fallback for {XDG_CACHE_HOME} is {user.home}. Getting {CSIDL_LOCAL_APPDATA} should always succeed, but I think a bit native code might have to be written to do it?

An equivalent to https://docs.rs/dirs/latest/dirs/fn.cache_dir.html might not be too hard. I don't know how to get those Windows directories on ScalaJS though.

from scribe.

darkfrog26 avatar darkfrog26 commented on September 21, 2024

If you'd be interested in testing this out I'd welcome a PR for the functionality. :)

from scribe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.