Skip to content

Commit c9f97a5

Browse files
Update version history for Java Code Visualizer
1 parent 2dad0f9 commit c9f97a5

1 file changed

Lines changed: 93 additions & 2 deletions

File tree

JavaCodeVisualizer_VersionHistory.md

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Java Code Visualizer — Version History
22

3-
## Development Timeline (May 23–28, 2026)
3+
## Development Timeline (May 23–31, 2026)
44

55
This document lists every version of `JavaCodeVisualizer.jsx` produced during the iterative development process, along with the changes made in each version.
66

@@ -186,7 +186,7 @@ Fixed two expression evaluator bugs that caused Bubble Sort to produce unsorted
186186

187187
---
188188

189-
### v14.0 (Final) — Example Programs Renamed with Descriptive Class Names
189+
### v14.0 — Example Programs Renamed with Descriptive Class Names
190190
**Lines:** ~2,928 | **Date:** May 28, 2026
191191

192192
Replaced `public class Main` in all 8 built-in example programs with descriptive class names.
@@ -206,6 +206,93 @@ Replaced `public class Main` in all 8 built-in example programs with descriptive
206206

207207
---
208208

209+
### v15.0 — Grade Calculator Example + String Concatenation Fix
210+
**Lines:** ~2,970 | **Date:** May 28, 2026
211+
212+
Added a 9th built-in example that exercises the Scanner input system, and fixed a string concatenation bug.
213+
214+
- **New example: Grade Calculator (Scanner)** — multi-input program using `nextLine()` and `nextInt()` in a for loop; collects student name, number of subjects, and marks; calculates total, average, and assigns grade (A+ through F) using `if`/`else if`/`else` chain
215+
- **String literal detection fix** — expressions like `"subject " + i + ":"` were treated as a single string literal because the expression started and ended with `"`. The string handler now finds the actual end of the first quoted string and falls through to the concatenation handler when more expression follows
216+
- All 9 examples verified working
217+
218+
---
219+
220+
### v16.0 — Inline Scanner Input Display
221+
**Lines:** ~2,980 | **Date:** May 28, 2026
222+
223+
User inputs now appear inline after prompts in the Output tab, matching real terminal behavior.
224+
225+
- **Before:** prompts and inputs shown separately — prompts as white text, inputs listed at the bottom with green `` markers
226+
- **After:** each input appears on the same line as its prompt (e.g., `Enter student name: Angshuman`)
227+
- **Interpreter change:** after consuming a Scanner input, the interpreter now appends the raw input value to the current output line (the prompt from `System.out.print`), then pushes a new empty line to simulate the user pressing Enter
228+
- **Output tab simplified** — removed the complex merging logic from v15; the interpreter itself handles inline display, so the Output tab renders a simple list of output lines
229+
- Example prompts updated to use `System.out.print` (no newline) instead of `println` for natural inline appearance
230+
- Bubble Sort and all other examples verified still working after changes
231+
232+
---
233+
234+
### v17.0 — Status Bar (Line Count, Character Count, Cursor Position)
235+
**Lines:** ~3,021 | **Date:** May 30, 2026
236+
237+
Added an IDE-style status bar at the bottom of the editor pane.
238+
239+
- **Left side:** cursor position — `Ln 10, Col 25` — updates in real-time via `selectionStart` tracking on click, keyup, and select events
240+
- **Right side:** code metrics — `24 lines · 487 chars · Java`
241+
- `cursorPos` state with `updateCursorPos` callback converts character offset to line/column numbers
242+
- Status bar uses `bgDeep` background and `border` color, blending with both dark and light themes
243+
- `flexShrink: 0` ensures the bar never collapses when the editor content is tall
244+
245+
---
246+
247+
### v18.0 (Final) — Quick Wins: Download, Fullscreen, Keyboard Shortcuts, Undo/Redo
248+
**Lines:** ~3,196 | **Date:** May 31, 2026
249+
250+
Completed all four "Quick Win" features in one release.
251+
252+
- **Download code button:**
253+
- Toolbar icon button (Download icon) between Reset and Fullscreen
254+
- Saves current editor content as a `.java` file named after the class (e.g., `BubbleSort.java`)
255+
- Uses `Blob` + `URL.createObjectURL` for client-side file generation
256+
- Also triggered via `Cmd/Ctrl+S` keyboard shortcut
257+
258+
- **Fullscreen toggle:**
259+
- Toolbar icon button that switches between `Maximize2` and `Minimize2` icons
260+
- Uses the browser Fullscreen API (`requestFullscreen` / `exitFullscreen`)
261+
- `appRef` on root container targets the entire app for fullscreen
262+
- Listens for `fullscreenchange` event to sync state when user presses Escape
263+
- Also triggered via `F11` keyboard shortcut
264+
265+
- **Keyboard shortcuts (global handler via `useEffect`):**
266+
- `Cmd/Ctrl + Enter` → Compile & Run
267+
- `Cmd/Ctrl + S` → Download as .java file (prevents browser's default save dialog)
268+
- `Cmd/Ctrl + /` → Toggle line comment (`//`) on current or selected lines
269+
- `Cmd/Ctrl + Z` → Undo
270+
- `Cmd/Ctrl + Shift + Z` → Redo
271+
- `Tab` → Insert 4 spaces (existing, unchanged)
272+
- `F11` → Toggle fullscreen
273+
274+
- **Comment toggling (`handleToggleComment`):**
275+
- Detects which lines are covered by the current selection
276+
- If all selected lines start with `//`, removes comments; otherwise adds `// ` prefix
277+
- Works on single line (cursor without selection) or multi-line selection
278+
279+
- **Undo/Redo system:**
280+
- `codeHistoryRef` stores up to 100 code snapshots
281+
- `historyIndexRef` tracks current position in the history stack
282+
- `updateCode()` wrapper pushes to history on every user edit (typing, Tab, comment toggle)
283+
- `handleUndo()` / `handleRedo()` navigate the history stack
284+
- `isUndoRedoRef` flag prevents undo/redo actions from being pushed as new history entries
285+
- Loading an example or file resets the history to a clean slate
286+
- Intercepts browser's native `Cmd+Z` to use custom history instead of textarea's broken built-in undo
287+
288+
- **Status bar updated:**
289+
- Shortcut hint badges added in the center: `⌘↵ Run`, `⌘S Save`, `⌘/ Comment`, `⌘Z Undo`, `F11 Fullscreen`
290+
- Subtle pill-shaped badges with `bgCard` background at 60% opacity
291+
292+
- Added `Download`, `Maximize2`, `Minimize2` to lucide-react imports
293+
294+
---
295+
209296
## Summary Table
210297

211298
| Version | Key Change | Lines |
@@ -224,3 +311,7 @@ Replaced `public class Main` in all 8 built-in example programs with descriptive
224311
| v12.0 | Copy/selection fix (native selection restored) | ~2,901 |
225312
| v13.0 | Interpreter fixes (chained subtraction + type cast) | ~2,927 |
226313
| v14.0 | Example programs renamed with descriptive class names | ~2,928 |
314+
| v15.0 | Grade Calculator example + string concatenation fix | ~2,970 |
315+
| v16.0 | Inline Scanner input display in Output tab | ~2,980 |
316+
| v17.0 | Status bar (line count, char count, cursor position) | ~3,021 |
317+
| v18.0 | Download, Fullscreen, Shortcuts, Undo/Redo | ~3,196 |

0 commit comments

Comments
 (0)