helpline 0.1.4 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0104ffa24a5e308f511265b3d573e071fa62f8a20f47395d860ccaad49c61b8
4
- data.tar.gz: 327ed27a2cdb89ff7e3dfc1d493a30b5fdaab9ff14532217c9c2180453646d12
3
+ metadata.gz: e2b4bd43a7abba5efc9ba94b4147be41d7106bf6bbf3832587601bc4a4421084
4
+ data.tar.gz: a4e5db23fc30f5009bf22e2ac24ad07da6ebda7690f0fb6140268c07e612765b
5
5
  SHA512:
6
- metadata.gz: c62a6cebf987469aa8851ad2bf2a61bfe84727488275f1ee249b914ea57291d65c401e9bb5793b151f29c58f0206a18b7e0f8f168a1d4d345740582c44f2b4b2
7
- data.tar.gz: de05a2efb87c6cb738b672124082097f7a49e176868575be736733cbe661c15e99d9f6ff38aba1dab21eabe54848485dfef4bdc8d74dd174ad3ff94fd21b78b3
6
+ metadata.gz: 9d7f707aa3220a134a403f62ca0ee212caa944668ccb6e97799d4aa2d5eb1f66f7725c6d6491c2662506fd074435b14eb007c2b64e00c9e9e66e7baa2e8a01ee
7
+ data.tar.gz: 29aa3951271e1a640e3cee3727d85df7baa7269abb9e73caa865d41eb186eb5600d4ff86fbc6f568e4f7b750dc97b38294e1d8dbe215692bd85665d9f037191e
@@ -99,15 +99,16 @@ class HelpLine
99
99
  lines = LINES if lines > LINES
100
100
  (0...lines).each { |i|
101
101
  Curses.move(i,0)
102
- s = "[#{i}] #{list[i][0]}"
102
+ s = "* #{list[i][0]}"
103
103
  if i == sel
104
104
  Curses.print_inverse s
105
105
  else
106
106
  Curses.print s
107
107
  end
108
108
  }
109
- Curses.down
110
- Curses.tol
109
+ Curses.move(sel,0)
110
+ # Curses.down
111
+ # Curses.tol
111
112
  end
112
113
 
113
114
  def helpline
@@ -129,17 +130,17 @@ class HelpLine
129
130
  #
130
131
  # HelpLineエントリ
131
132
  #
132
- lines = []
133
+ entries = []
133
134
  data['defs'].each { |line|
134
135
  if line =~ /^\s*\$\s*(.*)$/ # $....
135
- lines << $1
136
+ entries << $1
136
137
  elsif line =~ /^\s*\%\s*(.*)$/ # %....
137
138
  cmd = $1
138
- lines.each { |l|
139
+ entries.each { |l|
139
140
  desc = eval('"' + l + '"')
140
141
  g.add desc.force_encoding('utf-8'), cmd.force_encoding('utf-8')
141
142
  }
142
- lines = []
143
+ entries = []
143
144
  end
144
145
  }
145
146
 
@@ -149,7 +150,7 @@ class HelpLine
149
150
 
150
151
  if res[0].length == 0
151
152
  puts "ヘルプがみつかりません"
152
- File.open("/tmp/helpline","w"){ |f|
153
+ File.open("/tmp/helpline.cmd","w"){ |f|
153
154
  f.puts ARGV.join(' ')
154
155
  }
155
156
  exit
@@ -179,6 +180,9 @@ class HelpLine
179
180
  sel = 0
180
181
  disp(list,sel)
181
182
 
183
+ lines = list.length
184
+ lines = LINES if lines > LINES
185
+
182
186
  inputchars = ''
183
187
  while true
184
188
  c = STDIN.getch
@@ -196,7 +200,7 @@ class HelpLine
196
200
  inputchars = ''
197
201
  elsif inputchars == "\x0e" || inputchars == "\e[B" || inputchars == "\eOB"
198
202
  Curses.down
199
- sel = (sel + 1) if sel < LINES-1
203
+ sel = (sel + 1) if sel < lines-1
200
204
  inputchars = ''
201
205
  elsif inputchars == "\x10" || inputchars == "\e[A" || inputchars == "\eOA"
202
206
  Curses.up
@@ -218,9 +222,13 @@ class HelpLine
218
222
  desc = list[sel.to_i][0]
219
223
  cmd = list[sel][1]
220
224
 
225
+ Curses.move(lines,0)
226
+ #Curses.move(0,0)
227
+ ##Curses.down
228
+ ##Curses.tol
221
229
  Curses.print_inverse("「#{desc}」を実行")
222
230
  puts " (ソース: http://scrapbox.io/HelpLine/#{data['pages'][help_number[desc]]})"
223
- File.open("/tmp/helpline","w"){ |f|
231
+ File.open("/tmp/helpline.cmd","w"){ |f|
224
232
  f.puts cmd
225
233
  }
226
234
  end
data/keydef.zsh CHANGED
@@ -1,8 +1,9 @@
1
1
  #
2
- # Ctrl-Hでhelplineを呼ぶようにする
2
+ # Ctrl-Jでhelplineを呼ぶようにする
3
3
  #
4
4
  function run-help() {
5
- BUFFER=$(/Applications/HelpLine.app/Contents/MacOS/helpline "${BUFFER}")
5
+ /usr/local/bin/helpline "${BUFFER}" < $TTY
6
+ BUFFER=$(cat /tmp/helpline.cmd)
6
7
  CURSOR=${#BUFFER}
7
8
  zle redisplay
8
9
  }
@@ -1,4 +1,7 @@
1
-
1
+ #
2
+ # カーソル移動ライブラリ
3
+ # cursesを使うほどではないので
4
+ #
2
5
 
3
6
  # ESC [ Pl A
4
7
  # カーソルをPl行上へ移動
@@ -1,3 +1,3 @@
1
1
  module Helpline
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helpline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshiyuki Masui