lucaterm 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb1f374a09f0de19e379ea58a0d99d4dc7a0e5eb417bb98121c45a9b60b16043
4
- data.tar.gz: 7fe2cf713fafcc830e1e43132385988073e9ea60b856916f19980f8e9bc8e7d1
3
+ metadata.gz: a5c025e9af43938b46faab013fb8ad4bde69e7467c022deb4d08497aaa7b32eb
4
+ data.tar.gz: 2cf8e35f2adfbe9ab7957aa45e94c8af5354b97a19c410dee0a996c0e144884a
5
5
  SHA512:
6
- metadata.gz: db9a08c3a2014a9c35e51ec242ea1b1d1ab74fb211dddf6cf2baedc6a6ef7d1a615db33dc12ae6d1c06f1b275049e3da7f767c34e5f13aa89f2c770e9d76309a
7
- data.tar.gz: 24da76ce1f12b9a55d974375274ce7c8a406502bd1e083760b1e22a565eb78bb6ccf0a9559105d84aaae0703a0d6cfc3a228f6bf732f221a16fe55ac9280e56d
6
+ metadata.gz: ab2d8588d7e8f0903a74ed9005aee9637ac711c2653303606b7ed93b2c867da47eb6b6ec47836f6c2819534ba7099b94903124dec3a1fcde1b245b5814204425
7
+ data.tar.gz: ee9956b01ffdd4022052f8a6d573005c3546106f33b5d14a013f29a30c19779fcc2adab42bfb655340a3cc327e041577ca5d8041d11dc990a3b44691cb8cef14
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## LucaTerm 0.1.2
2
+
3
+ * `luca book`: '<' for prev month, '>' for next month.
4
+ * `luca book`: Refine 'm' command. Year is now optional. Cleanup dialog background.
5
+
1
6
  ## LucaTerm 0.1.1
2
7
 
3
8
  * `luca book`: handle cursor on journal detail
@@ -10,8 +10,10 @@ module LucaTerm
10
10
  include Curses
11
11
  attr_accessor :window
12
12
 
13
- def initialize(window, data=nil)
13
+ def initialize(window, year, month, data=nil)
14
14
  @window = window
15
+ @year = year
16
+ @month = month
15
17
  @data = data
16
18
  @index = 0
17
19
  @active = 0 # active line in window
@@ -21,7 +23,7 @@ module LucaTerm
21
23
  end
22
24
 
23
25
  def self.journals(window, *args)
24
- new(window, LucaSupport::Code.readable(LucaBook::List.term(*args).data))
26
+ new(window, args[0], args[1], LucaSupport::Code.readable(LucaBook::List.term(*args).data))
25
27
  end
26
28
 
27
29
  def main_loop
@@ -50,8 +52,24 @@ module LucaTerm
50
52
  when 'G'
51
53
  cursor_last @data
52
54
  when 'm'
53
- ym = edit_dialog('Change month: yyyy m')&.split(/[\/\s]/)
55
+ ym = edit_dialog('Change month: [yyyy] m')&.split(/[\/\s]/)
56
+ ym = [@year, ym[0]] if ym.length == 1
54
57
  @data = LucaSupport::Code.readable(LucaBook::List.term(*ym).data)
58
+ @year, @month = ym
59
+ @index = 0
60
+ @active = 0
61
+ @visible = set_visible(@data)
62
+ when '<'
63
+ target = Date.parse("#{@year}-#{@month}-1").prev_month
64
+ @data = LucaSupport::Code.readable(LucaBook::List.term(target.year, target.month).data)
65
+ @year, @month = target.year, target.month
66
+ @index = 0
67
+ @active = 0
68
+ @visible = set_visible(@data)
69
+ when '>'
70
+ target = Date.parse("#{@year}-#{@month}-1").next_month
71
+ @data = LucaSupport::Code.readable(LucaBook::List.term(target.year, target.month).data)
72
+ @year, @month = target.year, target.month
55
73
  @index = 0
56
74
  @active = 0
57
75
  @visible = set_visible(@data)
@@ -194,11 +212,13 @@ module LucaTerm
194
212
  def edit_dialog(message = '')
195
213
  sub = window.subwin(4, 30, (window.maxy-4)/2, (window.maxx - 30)/2)
196
214
  sub.box(?|, ?-)
197
- sub.setpos(1, 3)
198
- sub << message
215
+ sub.setpos(1, 1)
216
+ padding = [0, 30 - message.length - 4].max
217
+ sub << " #{message + ' ' * padding}"
199
218
  clrtoeol
200
- sub.setpos(2, 3)
201
- sub << "> "
219
+ sub.setpos(2, 1)
220
+ sub << " > #{' ' * (30 - 6)}"
221
+ sub.setpos(2, 6)
202
222
  clrtoeol
203
223
  sub.refresh
204
224
  loop do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaTerm
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucaterm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-13 00:00:00.000000000 Z
11
+ date: 2021-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses