首页 \ 问答 \ 用于切换Sublime Text 3侧栏的AutoHotkey脚本还是有本机ST设置?(AutoHotkey script for toggling Sublime Text 3 sidebar or is there a native ST setting?)

用于切换Sublime Text 3侧栏的AutoHotkey脚本还是有本机ST设置?(AutoHotkey script for toggling Sublime Text 3 sidebar or is there a native ST setting?)

我正在尝试编写一个AutoHotkey脚本来切换Sublime Text 3的侧边栏。 这是我到目前为止所拥有的:

; Custom Script for Sublime Text 3
; Map 'F10' key to Control+k, Control+b (open/close sidebar)

; If in Sublime Text
#IfWinActive ahk_class PX_WINDOW_CLASS
F10::
    Send {Ctrl down}
    SetKeyDelay -1
    Send {k down}
    SetKeyDelay 0
    Send {Ctrl down}
    SetKeyDelay -1
    Send {b down}
return

到目前为止,我可以切换侧边栏,但脚本不会将其切换回打开状态。

该脚本实际上会在Windows中导致奇怪的键盘功能,因此我不建议按原样进行测试。

我该如何重写它以便正确切换侧边栏?


I'm trying to write an AutoHotkey script for toggling Sublime Text 3's sidebar. Here's what I have so far:

; Custom Script for Sublime Text 3
; Map 'F10' key to Control+k, Control+b (open/close sidebar)

; If in Sublime Text
#IfWinActive ahk_class PX_WINDOW_CLASS
F10::
    Send {Ctrl down}
    SetKeyDelay -1
    Send {k down}
    SetKeyDelay 0
    Send {Ctrl down}
    SetKeyDelay -1
    Send {b down}
return

So far I can toggle the sidebar closed but the script is not toggling it back open.

The script actually causes weird keyboard functionality in Windows so I don't recommend testing it as is.

How can I rewrite this so it toggles the sidebar properly?


原文:https://stackoverflow.com/questions/29839915
更新时间:2022-10-21 07:10

最满意答案

浮点运算是不精确的。 当你加上n相同的double s,并将结果除以n ,你并不总是得到你开始的数字。

例如,以下内容:

double x = 0.1;
double y = x + x + x;
System.out.println(y / 3. - x);

版画

1.3877787807814457E-17

我强烈推荐每个计算机科学家应该知道的关于浮点运算的内容


Floating-point arithmetic is inexact. When you add up n identical doubles, and divide the result by n, you don't always get the number you started with.

For example, the following:

double x = 0.1;
double y = x + x + x;
System.out.println(y / 3. - x);

prints

1.3877787807814457E-17

I highly recommend What Every Computer Scientist Should Know About Floating-Point Arithmetic.

相关问答

更多
  • 转换输出太晚了; 计算已经在整数运算中发生。 您需要将输入转换为double : System.out.println((double)completed/(double)total); 请注意,您实际上并不需要转换它们; 只要一个是double ,另一个将被隐式转换。 但是我更喜欢做这两个对称。 Converting the output is too late; the calculation has already taken place in integer arithmetic. You nee ...
  • 所以只需要开始一件事:一直使用getDenom(),因为在你的代码中有时它是getDenom,有时候会这样说。 对于add()方法:在denoms是不同的情况下,你错了。 你必须做 : denom = this.getDenom() * x.getDenom(); num = this.getNum() * x.getDenom() + x.getNumer() * this.getDenom(); //and check if simplification is possible. return new ...
  • 因为1和2是整数。 结果是0.如果你把它转换为双,它仍然是0.这个问题就在几天前被问到。 Because 1 and 2 are integers. The result is 0. If you cast that to a double, it's still 0. This question was asked just a couple of days ago.
  • 您可以通过以下几种方式映射此功能: public interface MyLibrary extends Library { void examplefunct(Pointer dd); void examplefunct(java.nio.Buffer dd); void examplefunct(double[] dd); } 如果分配com.sun.jna.Memory的实例,则可以使用各种内存访问器函数将双精度写入缓冲区。 如果您使用直接NIO ByteBuffer,则可以 ...
  • 以下是相关的部门经营者: public static double operator /(double x, double y) public static int operator /(int x, int y) 有一个从int到double的隐式转换,但不是其他的方式......所以如果你用整数除int ,你将使用整数形式......但是如果两个操作数都是double,它将使用双重形式。 没有必要使两个操作数double - 但是如果您将除数操作数设为double而不是强制转换,那么您的代码至少会更短 ...
  • 问题是您还使用了double来索引数组。 所以试试这个: public static void selectionSort (double...arr) { int i = 0, j = 0, smallest = 0; double temp = 0.0; for (i = 0; i < arr.length - 1; i++) { smallest = i; for (j = 1; j < arr.length - 1; j++) ...
  • 没有办法提前停止,使用整数除法可能会更慢。 例如,在Skylake上: idiv r/m32 L: 26-27 T: 6 divsd xmm, xmm L: 13-14 T: 4 ( 来源 ) 因此,双重分割的速度是原来的两倍,并且具有明显更好的吞吐量。 那是在你考虑额外的乘法和额外的演员之前。 在较旧的μarchs上,32位整数除法通常具有比双除法更低的等待时间数, 但是它们变化更多( 除了用于更多串行),(对于浮点数)圆除数更快但是对于整数除法它的结果更小更快。 这种特征的差异可以使它以任何方式摆动, ...
  • 浮点运算是不精确的。 当你加上n相同的double s,并将结果除以n ,你并不总是得到你开始的数字。 例如,以下内容: double x = 0.1; double y = x + x + x; System.out.println(y / 3. - x); 版画 1.3877787807814457E-17 我强烈推荐每个计算机科学家应该知道的关于浮点运算的内容 。 Floating-point arithmetic is inexact. When you add up n identical d ...
  • dividend_Hi只是你2n位红利的上半部分。 因此,假设您的股息为6(110),除数为2(10)。 在这种情况下, n将为3,因为这是表示整数所需的最小位数。 因此,对于2n位的被除数(2n = 6),您只需用零填充左侧(000110)。 int dividend = 6; int divisor = 2; int n1 = Integer.SIZE - Integer.numberOfLeadingZeros(dividend); int n2 = Integer.SIZE - Integer.n ...
  • 有一个众所周知的用于快速整数除法的C / C ++ libdivide库,我对Java libdivide4j的这个库进行了改编 。 使用libdivide4j快速划分如下: void reduceArrayFast(long[] data, long denominator){ FastDivision.Magic magic = FastDivision.magicSigned(denominator); for(int i = 0; i < data.length; ++i) ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)