Skip to content

Commit

Permalink
If there are no focused goals, print the unfocused goals
Browse files Browse the repository at this point in the history
Match the coqide's goal message format. This is important for indicating
whether an unfocused goal needs to be focused or the proof is done.
  • Loading branch information
Kyle Stemen committed Oct 3, 2017
1 parent b458461 commit c4e8f50
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions autoload/coquille.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,22 @@ def show_goal(self, feedback_callback):
goals = response.val.val

sub_goals = goals.fg
msg_format = '{0} subgoal{1}'
if not sub_goals:
sub_goals = []
for (before, after) in goals.bg:
sub_goals.extend(reversed(before))
sub_goals.extend(after)
if sub_goals:
msg_format = ('This subproof is complete, but there {2} {0}'
' unfocused goal{1}')
if not sub_goals:
msg_format = 'No more subgoals.'

nb_subgoals = len(sub_goals)
plural_opt = '' if nb_subgoals == 1 else 's'
self.goal_buffer[0] = '%d subgoal%s' % (nb_subgoals, plural_opt)
self.goal_buffer[0] = msg_format.format(nb_subgoals,
'' if nb_subgoals == 1 else 's',
'is' if nb_subgoals == 1 else 'are')
self.goal_buffer.append([''])

for idx, sub_goal in enumerate(sub_goals):
Expand Down

0 comments on commit c4e8f50

Please sign in to comment.